import asyncio

from autobahn.asyncio import WebSocketServerFactory

from Lib.Server import config
from Lib.WebSocketProtocol import MyServerProtocol

factory = WebSocketServerFactory()
factory.protocol = MyServerProtocol
loop = asyncio.get_event_loop()
coro = loop.create_server(factory, config.get("base", 'host'), config.get("base", "ws_port"))
loop.run_until_complete(coro)
loop.run_forever()
